package com.codeyang.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.codeyang.domain.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 描述: TO-删除标志-DO
 *
 * @author CodeYang_Site
 * @version 2021/5/24 10:03
 */
@Mapper
public interface SysMenuMapper extends BaseMapper<SysMenu> {

    /**
     * 根据用户id查询 用户菜单
     *
     * @param userId
     * @return
     */
    @Select(" SELECT DISTINCT * FROM `sys_menu` as t1 ,sys_role_menu as t2, sys_user_role as t3 where  t1.menu_id=t2.menu_id and t2.role_id = t3.role_id and t3.user_id = #{userId}  ")
    List<SysMenu> findMenuListById(@Param("userId") Long userId);


}